{% extends 'myadmin/index.html' %}

{% block title %}
<title>后台-会员列表</title>
{% endblock %}
{% block index %}
<a href="{% url 'myadmin_index' %}">
    <i class="am-icon-home sidebar-nav-link-logo"></i> 首页
</a>
{% endblock %}
{% block goods %}
<li class="sidebar-nav-link">
    <a href="javascript:;" class="sidebar-nav-sub-title active">
        <i class="am-icon-shopping-bag sidebar-nav-link-logo"></i> 商品管理
        <span class="am-icon-chevron-down am-fr am-margin-right-sm sidebar-nav-sub-ico"></span>
    </a>
    <ul class="sidebar-nav sidebar-nav-sub" style="display: block;">
        <li class="sidebar-nav-link">
            <a href="{% url 'myadmin_goods_index' %}" class="active">
                <span class="am-icon-angle-right sidebar-nav-link-logo"></span> 商品列表
            </a>
        </li>
    </ul>
</li>
{% endblock %}




{% block main %}

<script type="text/javascript" src="/static/myadmin/js/jquery.min.js"></script>
<div class="row-content am-cf">
  <div class="row">
    <div class="am-u-sm-12 am-u-md-12 am-u-lg-12">
      <div class="widget am-cf">
        <div class="widget-head am-cf">
          <div class="widget-title  am-cf">会员列表</div></div>
        <div class="widget-body  am-fr">
          <div class="am-u-sm-12 am-u-md-6 am-u-lg-6">
            <div class="am-form-group">
              <div class="am-btn-toolbar">
                <div class="am-btn-group am-btn-group-xs">
                  <a href="{% url 'myadmin_goods_add' %}?p={{request.GET.p}}&types={{request.GET.types}}&textVal={{request.GET.textVal}}" class="am-btn am-btn-default am-btn-success">
                    <span class="am-icon-plus"></span>新增</a>
                  <button type="button" class="am-btn am-btn-default am-btn-secondary">
                    <span class="am-icon-save"></span>保存</button>
                  <button type="button" class="am-btn am-btn-default am-btn-warning">
                    <span class="am-icon-archive"></span>审核</button>
                  <a class="am-btn am-btn-default am-btn-danger">
                    <span class="am-icon-trash-o"></span>删除</a>
                </div>
              </div>
            </div>
          </div>
          <form>
          <div class="am-u-sm-12 am-u-md-6 am-u-lg-3">
            <div class="am-form-group tpl-table-list-select">
              <select name="types" data-am-selected="{btnSize: 'sm'}" class="sel">
                <option value="all"{% if request.GET.types == 'all' %} selected {% endif %}>所有</option>
                <option value="title"{% if request.GET.types == 'title' %} selected {% endif %}>商品标题</option>
                <option value="price"{% if request.GET.types == 'price' %} selected {% endif %}>价格</option>
                <option value="status"{% if request.GET.types == 'status' %} selected {% endif %}>状态</option>
                </select>
            </div>
          </div>
          <div class="am-u-sm-12 am-u-md-12 am-u-lg-3">
            <div class="am-input-group am-input-group-sm tpl-form-border-form cl-p inp">
              <input value="{{request.GET.textVal}}" type="text" class="am-form-field " name="textVal">
              <span class="am-input-group-btn">
                <button class="am-btn  am-btn-default am-btn-success tpl-table-list-field am-icon-search"></button>
              </span>
            </div>
          </div>
          </form>
          <script type="text/javascript">
              $(".sel").change(function(){
                  vals = $(this).val()
                  inp = $('<input value="{{request.GET.textVal}}" type="text" class="am-form-field " name="textVal">')
                  if (vals == "price"){
    $(".inp input").remove()
    inp1 = '<input value="{{request.GET.mon}}" type="text" class="am-form-field " placeholder="￥" name="mon" style="width:50px"/><input placeholder="￥" value="{{request.GET.mon1}}" type="text" class="am-form-field " name="mon1" style="width:50px">'
    $(".inp").prepend(inp1)
                  }else{
                    $(".inp input").remove()
                    $(".inp").prepend(inp)
                  }
              })
              if ($(".sel").val() == "price"){
                   $(".inp input").remove()
    inp1 = $('<input value="{{request.GET.mon}}" type="text" class="am-form-field " placeholder="￥" name="mon" style="width:50px"/><input placeholder="￥" value="{{request.GET.mon1}}" type="text" class="am-form-field " name="mon1" style="width:50px">')
    $(".inp").prepend(inp1)
              }
          </script>
          <div class="am-u-sm-12">
            <table width="100%" class="am-table am-table-compact am-table-striped tpl-table-black " id="">
              <thead>
                <tr>
                  <th>ID</th>
                  <th>所属分类</th>
                  <th>商品缩略图</th>
                  <th>商品标题</th>
                  <th>价格</th>
                  <th>库存</th>
                  <th>点击量</th>
                  <th>购买量</th>
                  <!-- <th>状态</th> -->
                  <th>发布时间</th>
                  <th>操作</th>
                </tr>
              </thead>
              <tbody>
              {% for i in data %}
                <tr class="gradeX">
                  <td>{{i.ind}}</td>
                  <td>{{i.cateid.name}}</td>
                  <td>
                  <img src="{{i.pic_url}}" width="100">
                  </td>
                  <td>{{i.title}}</td>
                  <td>{{i.price}}</td>
                  <td>{{i.store}}</td>
                  <td>{{i.clicknum}}</td>
                  <td>{{i.ordernum}}</td>
                 <!--  <td>
                  {% if i.status == 0 %}
                  新发布
                  {% elif i.status == 1 %}
                  热卖
                  {% else %}
                  下架
                  {% endif %}
                  </td> -->
                  <td>{{i.addtime}}</td>
                  <td>
                    <div class="tpl-table-black-operation">
                      <a href="{% url 'myadmin_goods_update' i.id %}?p={{request.GET.p}}&types={{request.GET.types}}&textVal={{request.GET.textVal}}">
                        <i class="am-icon-pencil"></i>编辑</a>
                      <a href='{% url "myadmin_goods_del" i.id %}?p={{request.GET.p}}&types={{request.GET.types}}&textVal={{request.GET.textVal}}' class="tpl-table-black-operation-del">
                        <i class="am-icon-trash"></i>删除</a>
                    </div>
                  </td>
                </tr>
                {% endfor %}
                <!-- more data --></tbody>
            </table>
          </div>
          <div class="am-u-lg-12 am-cf">
            <div class="am-fr">
              <ul class="am-pagination tpl-pagination">
                  <!-- {% for i in data.paginator.page_range %}
                <li>
                  <a href="?p={{i}}">{{i}}</a></li>
                  {% endfor %}
                  <li> -->
                  <!-- {% for i in data.paginator.page_range %}
                  <li><a href="?p={{i}}">{{i}}</a></li>
                  {% endfor %} -->
                  {% load pagetag %}
                  {% showPage data.paginator.num_pages request %}
              </ul>
            </div>
          </div>
        </div>
      </div>
    </div>
  </div>
</div>
<script>
   $("#del").click(function(){
      return false;
   })
</script>
</div>
{% endblock %}